#ifndef __DICTIONARY_H__
#define __DICTIONARY_H__

#include <vector>
#include <string>
#include <map>
#include <set>

using std::vector;
using std::string;
using std::pair;
using std::map;
using std::set;

class Dictionary{
public:
    static Dictionary *createInstance();
    void init(const string &dictpath, const string &indexpath);
    vector<pair<string, int>> &getDict();
    map<string, set<int>> &getIndexTable();
    int doQuery(const string &key);

private:
    Dictionary();

private : 
    static Dictionary *_instance;
    vector<pair<string, int>>_dict;
    map<string, set<int>> _index;
};

#endif
